﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
	<Style x:Key="ComboBoxPopupStyle" TargetType="Popup">
		<Setter Property="AllowsTransparency" Value="True" />
		<Setter Property="PopupAnimation" Value="Fade" />
		<Setter Property="Placement" Value="Bottom" />
		<Setter Property="CacheMode">
			<Setter.Value>
				<BitmapCache />
			</Setter.Value>
		</Setter>
		<Style.Triggers>
			<Trigger Property="IsOpen" Value="True">
				<Trigger.EnterActions>
					<BeginStoryboard>
						<Storyboard>
							<DoubleAnimation Storyboard.TargetProperty="VerticalOffset" From="-20" Duration="0:0:0.3">
								<DoubleAnimation.EasingFunction>
									<QuarticEase />
								</DoubleAnimation.EasingFunction>
							</DoubleAnimation>
						</Storyboard>
					</BeginStoryboard>
				</Trigger.EnterActions>
			</Trigger>
		</Style.Triggers>
	</Style>
	<Style x:Key="ComboBoxStyle" TargetType="ComboBox">
		<Setter Property="BorderThickness" Value="1" />
		<Setter Property="Padding" Value="5,0" />
		<Setter Property="VerticalContentAlignment" Value="Center" />
		<Setter Property="HorizontalContentAlignment" Value="Left" />
		<Setter Property="Foreground" Value="{DynamicResource Black}" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="ComboBox">
					<Grid x:Name="templateRoot" SnapsToDevicePixels="True">
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="*" />
							<ColumnDefinition MinWidth="17" Width="0" />
						</Grid.ColumnDefinitions>
						<Popup x:Name="PART_Popup" Grid.ColumnSpan="2"
								IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
								Style="{StaticResource ComboBoxPopupStyle}">
							<!--<Border MaxHeight="{TemplateBinding MaxDropDownHeight}"
									MinWidth="{Binding ActualWidth, ElementName=templateRoot}">-->
							<Border x:Name="DropDownBorder" BorderBrush="#FFC6C6C6" BorderThickness="1"
									Background="{DynamicResource White}" MaxHeight="{TemplateBinding MaxDropDownHeight}"
									MinWidth="{Binding ActualWidth, ElementName=templateRoot}">
								<ScrollViewer x:Name="DropDownScrollViewer">
									<!--<Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
											<Canvas x:Name="canvas" HorizontalAlignment="Left" Height="0"
													VerticalAlignment="Top" Width="0">
												<Rectangle x:Name="OpaqueRect"
														Fill="{Binding Background, ElementName=DropDownBorder}"
														Height="{Binding ActualHeight, ElementName=DropDownBorder}"
														Width="{Binding ActualWidth, ElementName=DropDownBorder}" />
											</Canvas>-->
									<VirtualizingStackPanel x:Name="ItemsPresenter"
											KeyboardNavigation.DirectionalNavigation="Contained"
											SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
											IsItemsHost="True" IsVirtualizing="True" />
									<!--</Grid>-->
								</ScrollViewer>
							</Border>
							<!--</Border>-->
						</Popup>
						<ToggleButton x:Name="toggleButton" BorderBrush="{TemplateBinding BorderBrush}"
								BorderThickness="{TemplateBinding BorderThickness}"
								Background="{TemplateBinding Background}" Grid.ColumnSpan="2"
								IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
							<ToggleButton.Style>
								<Style TargetType="ToggleButton">
									<Setter Property="OverridesDefaultStyle" Value="True" />
									<Setter Property="IsTabStop" Value="False" />
									<Setter Property="Focusable" Value="False" />
									<Setter Property="ClickMode" Value="Release" />
									<Setter Property="Template">
										<Setter.Value>
											<ControlTemplate TargetType="ToggleButton">
												<Border x:Name="templateRoot" BorderBrush="#FFACACAC"
														BorderThickness="{TemplateBinding BorderThickness}"
														SnapsToDevicePixels="True"
														Background="{DynamicResource ButtonNormalBackground}">
													<Border x:Name="splitBorder" BorderBrush="Transparent"
															BorderThickness="1" HorizontalAlignment="Right" Margin="0"
															SnapsToDevicePixels="True" Width="17">
														<Path x:Name="Arrow"
																Data="F1M0,0L2.667,2.66665 5.3334,0 5.3334,-1.78168 2.6667,0.88501 0,-1.78168 0,0z"
																Fill="#FF606060" HorizontalAlignment="Center"
																Margin="0,2,0,0" VerticalAlignment="Center" />
													</Border>
												</Border>
												<ControlTemplate.Triggers>
													<MultiDataTrigger>
														<MultiDataTrigger.Conditions>
															<Condition
																	Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType=ComboBox}}"
																	Value="True" />
															<Condition
																	Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
																	Value="False" />
															<Condition
																	Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}"
																	Value="False" />
															<Condition
																	Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}"
																	Value="True" />
														</MultiDataTrigger.Conditions>
														<Setter Property="Background" TargetName="templateRoot"
																Value="{DynamicResource White}" />
														<Setter Property="BorderBrush" TargetName="templateRoot"
																Value="#FFABADB3" />
														<Setter Property="Background" TargetName="splitBorder"
																Value="Transparent" />
														<Setter Property="BorderBrush" TargetName="splitBorder"
																Value="Transparent" />
													</MultiDataTrigger>
													<Trigger Property="IsMouseOver" Value="True">
														<Setter Property="Fill" TargetName="Arrow" Value="Black" />
													</Trigger>
													<MultiDataTrigger>
														<MultiDataTrigger.Conditions>
															<Condition
																	Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
																	Value="True" />
															<Condition
																	Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType=ComboBox}}"
																	Value="False" />
														</MultiDataTrigger.Conditions>
														<Setter Property="Background" TargetName="templateRoot"
																Value="{DynamicResource ButtonMouseOverBackground}" />
														<Setter Property="BorderBrush" TargetName="templateRoot"
																Value="{DynamicResource ButtonMouseOverBorder}" />
													</MultiDataTrigger>
													<MultiDataTrigger>
														<MultiDataTrigger.Conditions>
															<Condition
																	Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
																	Value="True" />
															<Condition
																	Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType=ComboBox}}"
																	Value="True" />
														</MultiDataTrigger.Conditions>
														<Setter Property="Background" TargetName="templateRoot"
																Value="{DynamicResource White}" />
														<Setter Property="BorderBrush" TargetName="templateRoot"
																Value="#FF7EB4EA" />
														<Setter Property="Background" TargetName="splitBorder"
																Value="{DynamicResource ButtonMouseOverBackground}" />
														<Setter Property="BorderBrush" TargetName="splitBorder"
																Value="{DynamicResource ButtonMouseOverBorder}" />
													</MultiDataTrigger>
													<Trigger Property="IsPressed" Value="True">
														<Setter Property="Fill" TargetName="Arrow" Value="Black" />
													</Trigger>
													<MultiDataTrigger>
														<MultiDataTrigger.Conditions>
															<Condition
																	Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}"
																	Value="True" />
															<Condition
																	Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType=ComboBox}}"
																	Value="False" />
														</MultiDataTrigger.Conditions>
														<Setter Property="Background" TargetName="templateRoot"
																Value="{DynamicResource ButtonPressedBackground}" />
														<Setter Property="BorderBrush" TargetName="templateRoot"
																Value="{DynamicResource ButtonPressedBorder}" />
													</MultiDataTrigger>
													<MultiDataTrigger>
														<MultiDataTrigger.Conditions>
															<Condition
																	Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}"
																	Value="True" />
															<Condition
																	Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType=ComboBox}}"
																	Value="True" />
														</MultiDataTrigger.Conditions>
														<Setter Property="Background" TargetName="templateRoot"
																Value="{DynamicResource White}" />
														<Setter Property="BorderBrush" TargetName="templateRoot"
																Value="#FF569DE5" />
														<Setter Property="Background" TargetName="splitBorder"
																Value="{DynamicResource ButtonPressedBackground}" />
														<Setter Property="BorderBrush" TargetName="splitBorder"
																Value="{DynamicResource ButtonPressedBorder}" />
													</MultiDataTrigger>
													<Trigger Property="IsEnabled" Value="False">
														<Setter Property="Fill" TargetName="Arrow" Value="#FFBFBFBF" />
													</Trigger>
													<MultiDataTrigger>
														<MultiDataTrigger.Conditions>
															<Condition
																	Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}"
																	Value="False" />
															<Condition
																	Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType=ComboBox}}"
																	Value="False" />
														</MultiDataTrigger.Conditions>
														<Setter Property="Background" TargetName="templateRoot"
																Value="#FFF0F0F0" />
														<Setter Property="BorderBrush" TargetName="templateRoot"
																Value="#FFD9D9D9" />
													</MultiDataTrigger>
													<MultiDataTrigger>
														<MultiDataTrigger.Conditions>
															<Condition
																	Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}"
																	Value="False" />
															<Condition
																	Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType=ComboBox}}"
																	Value="True" />
														</MultiDataTrigger.Conditions>
														<Setter Property="Background" TargetName="templateRoot"
																Value="{DynamicResource White}" />
														<Setter Property="BorderBrush" TargetName="templateRoot"
																Value="#FFBFBFBF" />
														<Setter Property="Background" TargetName="splitBorder"
																Value="Transparent" />
														<Setter Property="BorderBrush" TargetName="splitBorder"
																Value="Transparent" />
													</MultiDataTrigger>
												</ControlTemplate.Triggers>
											</ControlTemplate>
										</Setter.Value>
									</Setter>
								</Style>
							</ToggleButton.Style>
						</ToggleButton>
						<Border x:Name="Border" Background="{DynamicResource White}"
								Margin="{TemplateBinding BorderThickness}">
							<TextBox x:Name="PART_EditableTextBox"
									HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
									IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}"
									Margin="2,0" Padding="0"
									VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}">
								<TextBox.ContextMenu>
									<ContextMenu>
										<MenuItem Header="Cu_t" Command="ApplicationCommands.Cut"
												InputGestureText="Ctrl+X">
											<MenuItem.Icon>
												<Image
														Source="pack://application:,,,/Daytimer.Images;component/Images/cut.png" />
											</MenuItem.Icon>
										</MenuItem>
										<MenuItem Header="_Copy" Command="ApplicationCommands.Copy"
												InputGestureText="Ctrl+C">
											<MenuItem.Icon>
												<Image
														Source="pack://application:,,,/Daytimer.Images;component/Images/copy.png" />
											</MenuItem.Icon>
										</MenuItem>
										<MenuItem Header="_Paste" Command="ApplicationCommands.Paste"
												InputGestureText="Ctrl+V">
											<MenuItem.Icon>
												<Image
														Source="pack://application:,,,/Daytimer.Images;component/Images/paste_sml.png" />
											</MenuItem.Icon>
										</MenuItem>
									</ContextMenu>
								</TextBox.ContextMenu>
								<TextBox.Style>
									<Style TargetType="TextBox">
										<Setter Property="OverridesDefaultStyle" Value="True" />
										<Setter Property="AllowDrop" Value="True" />
										<Setter Property="MinWidth" Value="0" />
										<Setter Property="MinHeight" Value="0" />
										<Setter Property="FocusVisualStyle" Value="{x:Null}" />
										<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
										<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
										<Setter Property="SelectionBrush" Value="#FF7EB4EA" />
										<Setter Property="SelectionOpacity" Value="0.5" />
										<Setter Property="Foreground" Value="{DynamicResource Black}" />
										<Setter Property="Template">
											<Setter.Value>
												<ControlTemplate TargetType="TextBox">
													<ScrollViewer x:Name="PART_ContentHost" Background="Transparent"
															Focusable="False" HorizontalScrollBarVisibility="Hidden"
															VerticalScrollBarVisibility="Hidden" />
												</ControlTemplate>
											</Setter.Value>
										</Setter>
									</Style>
								</TextBox.Style>
							</TextBox>
						</Border>
						<ContentPresenter x:Name="contentPresenter"
								ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
								Content="{TemplateBinding SelectionBoxItem}"
								ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
								HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
								IsHitTestVisible="False" Margin="{TemplateBinding Padding}"
								SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
								VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
					</Grid>
					<ControlTemplate.Triggers>
						<Trigger Property="IsEnabled" Value="False">
							<Setter Property="Opacity" TargetName="Border" Value="0.56" />
						</Trigger>
						<Trigger Property="IsKeyboardFocusWithin" Value="True">
							<Setter Property="Foreground" Value="{DynamicResource Black}" />
						</Trigger>
						<Trigger Property="IsEditable" Value="False">
							<Setter Property="Visibility" TargetName="Border" Value="Collapsed" />
							<Setter Property="Visibility" TargetName="contentPresenter" Value="Visible" />
						</Trigger>
						<Trigger Property="HasItems" Value="False">
							<Setter Property="Height" TargetName="DropDownBorder" Value="95" />
						</Trigger>
						<!--<Trigger Property="CanContentScroll" SourceName="DropDownScrollViewer" Value="False">
							<Setter Property="Canvas.Top" TargetName="OpaqueRect"
									Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}" />
							<Setter Property="Canvas.Left" TargetName="OpaqueRect"
									Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}" />
						</Trigger>-->
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<Style TargetType="ComboBox" BasedOn="{StaticResource ComboBoxStyle}" />
</ResourceDictionary>